/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package presenter;

import boundary.AddAgenciaView;
import boundary.DirGeralView;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.UIDefaults.ActiveValue;

/**
 *
 * @author jakson
 */
public class DirGeralPresenter {

    private DirGeralView view;

    public DirGeralPresenter() {

        view = new DirGeralView();
        view.getItAgencia().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                chamarAddAgenciasView();
            }
        });

        view.getImSair().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                fechar();

            }
        });

        view.getItConsultaAgencia().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                chamarListarAgencias();
            }
        });

        view.getItmCliente().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                chamarAddClientesPresenter();
            }
        });

        view.getItmGerente().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                chamarAddGerentePresenter();
            }
        });

        view.getItmConsultaCliente().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                chamarListarClientesPresenter();
            }
        });
        
        view.getItmDirRegional().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
               chamarAddDirRegionalPresenter();
            }
        });
        
        view.getItmConsultaDirRegional().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                chamarListarDirRegionalPresenter();
            }
        });
        
        view.getItmconsultaGerente().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                chamarListarGerentePresenter();
            }
        });
        
        view.getItmAbrirConta().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                abrirConta();
            }
        });
        
        view.getItmManterConta().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
                manterConta();
            }
        });


        view.setLocationRelativeTo(view);
        view.setVisible(true);
    }

    public void fechar() {
        view.dispose();
    }

    public void chamarAddAgenciasView() {

        new AddAgenciaPresenter("nova",null);

    }

    public void chamarListarAgencias() {
        new ListarAgenciasPresenter();
    }

    public void chamarAddClientesPresenter() {
        new AddClientesPresenter("novo",null);
    }

    public void chamarAddGerentePresenter() {

        new AddGerentePresenter("",null);
    }

    public void chamarListarClientesPresenter() {

        new ListarClientePresenter("listarCliente");

    }
    
    public void chamarAddDirRegionalPresenter(){
        
        new AddDirRegionalPresenter("",null);
    }
    
    public void chamarListarDirRegionalPresenter(){
        
        new ListarDirRegionalPresenter();
    }
    
    public void chamarListarGerentePresenter(){
        
        new ListarGerentePresente("listar");
    }
    
    private void  abrirConta(){
        
         new ListarClientePresenter("criaConta");
    }
    
    private void manterConta(){
        new ListarContasCorrentesPresenter();
    }
}
